/*
*    作者：泡了砒霜的蒜
*    功能：控制多舵机点击350页，然后结束程序
*/
#include <Servo.h>

Servo servo1;
Servo servo2;
Servo servo3;
Servo servo4;

int pos = 0;   
int ttt;
int temp;
int i;


void setup() {
  servo1.attach(3);
  servo2.attach(5);
  servo3.attach(9);
  servo4.attach(10);
  i = 0;
}

void loop() {
  
    temp = random(30,100);      
    ttt =  temp * 100;                           //随机时间3~10S，可按照自己想法修改
//    delay(ttt);
    delay(2000);


    while (i<350){
//    for (i;i<5;i++){
//        delay(100);  
        
        pos = 5;
        servo1.write(pos); 
        servo2.write(pos); 
        servo3.write(pos); 
        servo4.write(pos); 
        delay(100);
        pos = 15;
        servo1.write(pos); 
        servo2.write(pos); 
        servo3.write(pos); 
        servo4.write(pos); 
        delay(100);
        pos = 45;
        servo1.write(pos); 
        servo2.write(pos); 
        servo3.write(pos); 
        servo4.write(pos);  
        delay(50);
        i + = 1;
        delay(ttt);
    }
    
}